import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/home/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      component: HomeView,
      children: [{
        path: '/detail/:id',
        component: () => import("@/views/detail/index.vue")
      }]
    },
    {
      path: '/login',
      component: () => import("@/views/login/index.vue") // webpack不需要/vite的组件必须得全称
    }
  ],
})

export default router
